//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Mapping Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;
using EntLibContrib.Mapping.Mappers;

namespace EntLibContrib.Mapping.Configuration
{
	/// <summary>
	/// Configuration data defining BasicMapperData. This configuration section adds the element
	/// </summary>    
	[Assembler(typeof(BasicMapperAssembler))]
	public class BasicMapperData : MapperData
	{
		#region Constants
		private const string domainObjectTypeNameProperty = "domainObjectTypeName";
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the name of the type of the domain object.
		/// </summary>
		/// <value>The name of the type of the domain object.</value>
		[ConfigurationProperty(domainObjectTypeNameProperty, IsRequired = true)]
		public string DomainObjectTypeName
		{
			get { return (string)base[domainObjectTypeNameProperty]; }
			set { base[domainObjectTypeNameProperty] = value; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="BasicMapperData"/> class.
		/// </summary>
		public BasicMapperData ()
		{
		}

		/// <summary>
		/// Initialize a new instance of the <see cref="BasicMapperData"/> class.
		/// </summary>
		/// <param name="name">The name of the <see cref="BasicMapperData"/>.</param>
		/// <param name="tableName">The data transfer object table name.</param>
		/// <param name="domainObjectTypeName">The domain object type name.</param>
		public BasicMapperData(string name, string tableName, string domainObjectTypeName)
			: base(name, tableName, typeof(BasicMapper))
		{
			this.DomainObjectTypeName = domainObjectTypeName;
		}
		#endregion
	}
}